import QtQuick
import QtQuick.Layouts
import QtCharts

Rectangle {
    Layout.fillWidth: true
    Layout.fillHeight: true

    ChartView {
        id: chartView
        title: "曲线图示例"
        titleFont.bold: true
        titleFont.pointSize: 14

        anchors.fill: parent
        antialiasing: true

        ValueAxis {
            id: valueAxisX
            min: 0
            max: 5
            titleText: "X Title"
        }

        ValueAxis {
            id: valueAxisY
            min: 0
            max: 10
            titleText: "Y Title"
        }

        SplineSeries {
            name: "spline"
            XYPoint { x: 0; y: 0 }
            XYPoint { x: 1; y: 3 }
            XYPoint { x: 2; y: 5 }
            XYPoint { x: 3; y: 3 }
            XYPoint { x: 4; y: 8 }
            XYPoint { x: 5; y: 10 }
            axisX: valueAxisX
            axisY: valueAxisY

            color: "#1296FF"
            capStyle: Qt.FlatCap  //Qt.SquareCap、Qt.RoundCap
            style: Qt.DashLine
            width: 2
        }
    }
}
